package com.yycx.module.bus.provider.handler.haiying.settle.deptsettle;

import com.yycx.common.base.entity.EntityMap;
import com.yycx.common.mybatis.interceptor.DeleteInterceptor;
import com.yycx.common.mybatis.query.CriteriaDelete;
import com.yycx.common.utils.ApiAssert;
import com.yycx.module.bus.provider.service.hy.BusHyorderReturnService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.io.Serializable;

/**
 * 部门结算申请单删除
 *
 * @author zyf
 */
@Component
public class HyDeptSettleApplyPaymentDeleteHandler implements DeleteInterceptor {

    @Resource
    private BusHyorderReturnService orderDetailsService;


    @Override
    public void prepare(CriteriaDelete criteriaDelete, EntityMap entityMap) {
        Integer settleType = entityMap.getInt("settleType");
        ApiAssert.isNotEmpty("参数异常", settleType);
    }

    @Override
    public void complete(CriteriaDelete cd, EntityMap params) {
        Serializable paymentId = cd.getIdValue();
        orderDetailsService.clearDeptSettleApplyId(paymentId);
    }
}
